// 动物园
#include <iostream>
using namespace std;

class Date {
private:
    int year;
    int month;
    int day;

public:
    Date() {
        year = 2000;
        month = 1;
        day = 1;
    }

    void SetDate(int year, int month, int day) {
        this->year = year;
        this->month = month;
        this->day = day;
    }

    void ShowDate() {
        cout << year << "/" << month << "/" << day << "\n";
    }
};

// 分类
enum class Category {
    mammanl,    // 哺乳动物
    fish,
    bird,
    reptile,    // 爬行动物
    amphibian,  // 两栖动物
    insect,     // 昆虫
};

// 种类
enum class Species {
    dog,
    cat,
    scrubjay,
    sparrow,    // 麻雀
    frog,
    toad,       // 蟾蜍
};

class Animal {
private:
    Category category;
    Species species;
    string name;
    Date birth;

public:
    Animal(Category category, Species species, string name, Date birth) {
        this->category = category;
        this->species = species;
        this->name = name;
        this->birth = birth;
    }

    Species GetSpecies() {
        return species;
    }

    void Write() {
        const char* strCategory[6] = {
            "哺乳类",
            "fish",
            "鸟类",
            "reptile",
            "两栖类",
            "insect",
        };
        const char* strSpecies[6] = {
            "狗",
            "cat",
            "灌木鸟",
            "sparrow",
            "青蛙",
            "toad",
        };
        cout << "\n此动物是 " << strCategory[int(category)]
            << "(" << strSpecies[int(species)] << ")\n";
        cout << "名字: " << name << " 生日: ";
        birth.ShowDate();
    }
};

class Mammal : public Animal {
private:
    double height;

public:
    Mammal(Category category, Species species,
        string name, Date birth, double height)
        : Animal(category, species, name, birth) {
        this->height = height;
    }

    void SayHello() {
        switch (GetSpecies()) {
            case Species::dog:
                cout << "汪汪，你好。";
                break;
            case Species::cat:
                cout << "喵，你好。";
                break;
        }
        cout << "我的身高为 " << height << " 英尺\n";
    }

    void FavoriteFood() {
        switch (GetSpecies()) {
            case Species::dog:
                cout << "我喜欢吃饼干\n";
                break;
            case Species::cat:
                cout << "我喜欢吃小鸟\n";
                break;
        }
    }
};

class Bird : public Animal {
private:
    double wingspan;

public:
    Bird(Category category, Species species,
        string name, Date birth, double wingspan)
        : Animal(category, species, name, birth) {
        this->wingspan = wingspan;
    }

    void SayHello() {
        cout << "呱呱,你好。";
        cout << "我的翼展是 " << wingspan << " 英尺\n";
    }

    void FavoriteFood() {
        cout << "我喜欢吃花生。\n";
    }
};

class Amphibian : public Animal {
private:
    double length;

public:
    Amphibian(Category category, Species species,
        string name, Date birth, double length)
        : Animal(category, species, name, birth) {
        this->length = length;
    }

    void SayHello() {
        cout << "呱呱,你好。";
        cout << "我的身高是 " << length << " 英尺\n";
    }

    void FavoriteFood() {
        cout << "我喜欢吃苍蝇。\n";
    }
};

int main() {
    cout << "动物程序\n";

    Date birth;
    birth.SetDate(1995, 12, 25);

    Mammal fido(Category::mammanl, Species::dog, "Noel", birth, 2.5);
    fido.Write();
    fido.SayHello();
    fido.FavoriteFood();

    birth.SetDate(1999, 6, 10);
    Amphibian greenGuy(Category::amphibian, Species::frog, "Spooky", birth, 0.4);
    greenGuy.Write();
    greenGuy.SayHello();
    greenGuy.FavoriteFood();

    birth.SetDate(1998, 4, 25);
    Bird noisy(Category::bird, Species::scrubjay, "Mrs Blue", birth, 1.8);
    noisy.Write();
    noisy.SayHello();
    noisy.FavoriteFood();

    cout << "\n这个地方可真忙\n";
}